package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.xinyi;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.glsc.ngateway.common.api.common.enums.DictConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author liwei
 * 新意指令自定义指令执行记录表
 */
@Data
@Entity
@Table(name = "t_xinyi_define_log")
@org.hibernate.annotations.Table(appliesTo = "t_xinyi_define_log", comment = "新意指令自定义指令执行记录表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Where(clause = "deleted = 'N'")
@SQLDelete(sql = "update t_xinyi_define_log set deleted = 'Y' where id=?")
@SQLDeleteAll(sql = "update t_xinyi_define_log set deleted = 'Y' where id=?")
public class XinYiDefineLog implements Serializable {
    private static final long serialVersionUID = -2273924307561798855L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int(20) comment 'id'")
    private Integer id;

    @Column(name = "template_id", columnDefinition = "int(20) comment '模板id'")
    private Integer templateId;

    @ApiModelProperty(value = "模板名称")
    @Column(name = "name", columnDefinition = "varchar(255) COMMENT '模板名称'")
    private String name;

    @ApiModelProperty(value = "类型 数据字典t_xinyi_define_type")
    @Column(name = "type", columnDefinition = "varchar(255) COMMENT '类型 数据字典t_xinyi_define_type'")
    private String type;

    @ApiModelProperty(value = "收款方银行账号")
    @Column(name = "rec_bank_acc", columnDefinition = "varchar(255) COMMENT '收款方银行账号'")
    private String recBankAcc;

    @ApiModelProperty(value = "收款方银行账号名称")
    @Column(name = "rec_bank_acc_name", columnDefinition = "varchar(255) COMMENT '收款方银行账号名称'")
    private String recBankAccName;

    @ApiModelProperty(value = "收款方开户银行")
    @Column(name = "rec_open_account_bank", columnDefinition = "varchar(255) COMMENT '收款方开户银行'")
    private String recOpenAccountBank;

    @ApiModelProperty(value = "收款方大额行号")
    @Column(name = "rec_big_bank_acc", columnDefinition = "varchar(255) COMMENT '收款方大额行号'")
    private String recBigBankAcc;


    @ApiModelProperty(value = "付款方银行账号")
    @Column(name = "pay_bank_acc", columnDefinition = "varchar(255) COMMENT '付款方银行账号'")
    private String payBankAcc;

    @ApiModelProperty(value = "付款方银行账号名称")
    @Column(name = "pay_bank_acc_name", columnDefinition = "varchar(255) COMMENT '付款方银行账号名称'")
    private String payBankAccName;

    @ApiModelProperty(value = "付款方开户银行")
    @Column(name = "pay_open_account_bank", columnDefinition = "varchar(255) COMMENT '付款方开户银行'")
    private String payOpenAccountBank;

    @ApiModelProperty(value = "付款方大额行号")
    @Column(name = "pay_big_bank_acc", columnDefinition = "varchar(255) COMMENT '付款方大额行号'")
    private String payBigBankAcc;


    @ApiModelProperty(value = "指令金额")
    @Column(name = "occurAmt", columnDefinition = "varchar(255) COMMENT '指令金额'")
    private String occurAmt;


    @ApiModelProperty(value = "备注")
    @Column(name = "memo", columnDefinition = "varchar(255) COMMENT '备注'")
    private String memo;

    @Column(name = "create_id", columnDefinition = "int DEFAULT NULL COMMENT '创建人id'")
    @ApiModelProperty(value = "创建人id")
    private Long createId;

    @ApiModelProperty(value = "创建人名称")
    @Column(name = "create_name", columnDefinition = "varchar(100) COMMENT '创建人名称'")
    private String createName;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "是否删除，字典 YesNo:（N=未删除(默认) Y=已删除)")
    @Column(name = "deleted", columnDefinition = "varchar(20) default 'N' COMMENT '是否删除，字典 yesno （N=否(默认) Y=是)'")
    private String deleted = DictConstant.NO;

    @ApiModelProperty(value = "是否触发新意成功，字典 YesNo:（N=失败 Y=成功)")
    @Column(name = "status", columnDefinition = "varchar(20) default 'N' COMMENT '是否触发新意成功，字典 YesNo:（N=失败 Y=成功)'")
    private String status = DictConstant.YES;

}
